<?php
require('lib/verify.php');
require('lib/has_char.php');
require('lib/is_approved.php');

$sysid = $system["system_id"];

$character_id = $_GET["id"];
$sql = "select * from wm_characters where character_id = $character_id and character_system_id = $sysid";
$result = $db->query($sql);

if($db->num_rows($result)<1) {
    header("Location: $war_http/error-wrong-system.php");
    exit;
 }

if($character['character_admin'] == 1) $debug = 1;
 else $debug = 0;

$chara = $db->fetch_assoc($result);

$_category = "wardkp";
$_title = "Wishlist / " . $chara["character_name"];
require('lib/head.php');

if($_GET["error"]!="") {
    boxRed("Error");
    echo $_GET["error"];
    boxBot();
 }


boxTop("wardkp: $_title");
cclass($chara["character_class"]);
echo '<b><a href="character.php?id='.$chara["character_id"].'">'.$chara["character_name"].'</a>\'s Wishlist</b><br/><br/>';



for($h=bid_max();$h>=1;$h--){
    echo "<b>".bid2text($h)."</b><br />\n";
    $sql = "select distinct wish_item 
            from wm_wishes 
            where wish_character='$character_id' and 
                  wish_system_id='".$system['system_id']."' and 
                  wish_level='$h'";
    $result = $db->query($sql);
    while($wishes = $db->fetch_assoc($result)) {
        $wish['item_id'] = $wishes['wish_item'];
        show_link($wish);
        $sqla = "select boss_id, boss_name 
                         from wm_bosses, wm_items
			 where wm_items.item_boss = wm_bosses.boss_id and 
                               item_id = '".$wish["item_id"]."'";
        $bosses = $db->query($sqla);
        $abo = $db->fetch_assoc($bosses);
        echo 'drops from <a href="boss.php?id='.$abo["boss_id"].'">'.$abo["boss_name"].'</a>';
        while($abo = $db->fetch_assoc($bosses)) {
            echo ', <a href="boss.php?id='.$abo["boss_id"].'">'.$abo["boss_name"].'</a>';
        }
        echo "<br/><br/>\n";
		
    }
    echo "<br/><br/>\n";
 }


boxBot();

require('lib/foot.php');
?>

